package cn.dc406.labc406mgr.controller;


import cn.dc406.labc406mgr.entity.Itemdetails;
import cn.dc406.labc406mgr.mapper.ItemdetailsWapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class ItemdetailsController {
    @Autowired(required = false)//注入相应对的内容
    ItemdetailsWapper itemdetailsWapper;


    @CrossOrigin()
    @ResponseBody
    @RequestMapping("/selectbyburryName")
    public Itemdetails selectbyburryName(String name)
    {
        System.out.println("selectbyburryName");
        Itemdetails itemdetails =itemdetailsWapper.selectbyburryName(name);
        System.out.println(itemdetails);
        return itemdetails;
    }

    @CrossOrigin()
    @ResponseBody
    @RequestMapping("/Updatedetail")
    public Itemdetails Updatedetail(@RequestBody Itemdetails itemdetails)
    {
        System.out.println("Updatedetail");
        if(itemdetailsWapper.Updatedetail(itemdetails))
        {
            return itemdetails;
        }
        return null;
    }
}
